package com.mj.mybatis;

import java.lang.reflect.InvocationTargetException;

/**
 * @author 马洁
 * @date 2020/9/18 - 15:04
 */
public class ObjectPool {
    public static <T> T getObj(Class<T> cls) {
        Object res = null;

        try {
            res = cls.getConstructor().newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

        return (T) res;
    }
}
